UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'maaZtpy79hrw8GZW/KcjSAReamvIjjAVR1poZZuVDPQ=' 
WHERE 
  key_id = '87f1256a0b500c6fa6eeb578174a8d2eba7ed58abaddd32a8a81404700932181' 
  AND (
    token = 'maaZtpy79hrw8GZW/KcjSAReamvIjjAVR1poZZuVDPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027