UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aGTcRSMKZfpTzW/ho9o/5Bo1peyFe74w36LDR9ApdIk=' 
WHERE 
  key_id = '0f6ce2296df1e190052a787618225fcb83ed6a80103eb4d6cf6f8e405e922756' 
  AND (
    token = 'aGTcRSMKZfpTzW/ho9o/5Bo1peyFe74w36LDR9ApdIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024