UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q/94ObOKKW2UJUm3i1To/FRqbelkq+eZhGauulxswDk=' 
WHERE 
  key_id = 'ff3819ff295db970946fe235604e3183bafc93750b3d851f6a9b628f7b7bac57' 
  AND (
    token = 'Q/94ObOKKW2UJUm3i1To/FRqbelkq+eZhGauulxswDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034