UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4erRYgRV04pfvToGyTpi3djuB9YEC507n8CS4SeF7JM=' 
WHERE 
  key_id = '2aaac3499112574c736eb5202f9121cd65ba7d85921ffac19be1f80ccc61a5bf' 
  AND (
    token = '4erRYgRV04pfvToGyTpi3djuB9YEC507n8CS4SeF7JM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025