UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uf/3DFnLmdFBuhdGuUb9myYD+X372EMRaWZD8hBoTqs=' 
WHERE 
  key_id = 'b84fa26de249b02fff7488cd33c888e260be0ad9a512f5a3842ce887baf08bd1' 
  AND (
    token = 'uf/3DFnLmdFBuhdGuUb9myYD+X372EMRaWZD8hBoTqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038