UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YlhwPBIK2qkFjKuDhyj+RxzAyTl591cRRxLJ9zNFJig=' 
WHERE 
  key_id = '6b9d51540ea8d02a2f5016c4da3c532577ff67a9f57da22b51964ad69162a4f0' 
  AND (
    token = 'YlhwPBIK2qkFjKuDhyj+RxzAyTl591cRRxLJ9zNFJig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065