UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mk9W77+8NoWClS92AToG2PZXDwQK2lZv2Yk957NrHIQ=' 
WHERE 
  key_id = '365e0d33735178b3ace8fe1329aa4e90e37bd5601a93579491fe7622fe437a40' 
  AND (
    token = 'Mk9W77+8NoWClS92AToG2PZXDwQK2lZv2Yk957NrHIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031