UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OB6hpep4fuV8Cq5dhjUTO8ecn5AXNZelqbiPEnuO/9Q=' 
WHERE 
  key_id = '51a55da0eda4dd4f3cffda68c6f673597798a2719a297400a4936ee39e971068' 
  AND (
    token = 'OB6hpep4fuV8Cq5dhjUTO8ecn5AXNZelqbiPEnuO/9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059