UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HaGVMMM9qVefTPlCXTJmfg9FhJ7m+Q4RSTMcJ1yCsOs=' 
WHERE 
  key_id = '8286ef7943dbcb4996b6b44a308880c9dfcb536524af8a1ec7ba32cb3d2f3648' 
  AND (
    token = 'HaGVMMM9qVefTPlCXTJmfg9FhJ7m+Q4RSTMcJ1yCsOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041