UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n5vg2g8EvtNS5ca+KfkSUUHu7FIDNiS8tkrbCw8sM/k=' 
WHERE 
  key_id = '32f759c0c2234330f94c0e2431668803b6c5f8438f2092784549735d6784f764' 
  AND (
    token = 'n5vg2g8EvtNS5ca+KfkSUUHu7FIDNiS8tkrbCw8sM/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019