UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd2Ef0B1qkCyOsW+6ucJhmG4CXCQKnwy0zxCcfUdUTlk=' 
WHERE 
  key_id = '6ae6985614238bf2812ea03e4790852052376428420c4f47ea51258fe06d2528' 
  AND (
    token = 'd2Ef0B1qkCyOsW+6ucJhmG4CXCQKnwy0zxCcfUdUTlk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044