UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EDq6nd/5wcLWW0rgvZT8NFgdCyPW4qwvQ+CNVOwtpRY=' 
WHERE 
  key_id = '465bed69b15772c2d736d1711c26d8c206b6443b5c8021ab95a4b497042fda34' 
  AND (
    token = 'EDq6nd/5wcLWW0rgvZT8NFgdCyPW4qwvQ+CNVOwtpRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034