UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hqtR5t65qA9K3Jdwr+/4DsRAa355wU2BCRiV/lx2TJU=' 
WHERE 
  key_id = 'f9e9967d7a8ba4177a74ea8ecba877c88c77dbd1db5dc55da2eef91d7f0565d2' 
  AND (
    token = 'hqtR5t65qA9K3Jdwr+/4DsRAa355wU2BCRiV/lx2TJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023