UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fR7ztRhy30np3G5RO1RLxpb49MLqGahS1rtJb1TPoWk=' 
WHERE 
  key_id = '783bc5bafad0b397c0b58da557321bf36d20c5867900257438c12cf5ccbbd95d' 
  AND (
    token = 'fR7ztRhy30np3G5RO1RLxpb49MLqGahS1rtJb1TPoWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022