UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n+/kw+j7lkPfw37SdqYyCVyuvU0zw55ayfrvjSrL+iY=' 
WHERE 
  key_id = '89118e46066af028f1564019b3e0606682e53bfff114e55e25074d4778ef6c12' 
  AND (
    token = 'n+/kw+j7lkPfw37SdqYyCVyuvU0zw55ayfrvjSrL+iY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031