UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y9bbQFC3ihNSI2uU/cZtDTY1MKT3nt67abY1n5SdOkQ=' 
WHERE 
  key_id = 'd45fd59f78e95615f08f1b1916635b0be253307451b82dc960df63135986e80a' 
  AND (
    token = 'y9bbQFC3ihNSI2uU/cZtDTY1MKT3nt67abY1n5SdOkQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025