UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g/sA5W56qUe024FatX0ATYlm70cf6p7bi+cRNKILRrA=' 
WHERE 
  key_id = 'e06591db1a04b2c77b78e20013b83a8022aae3472db1745d11727f743a9bbe62' 
  AND (
    token = 'g/sA5W56qUe024FatX0ATYlm70cf6p7bi+cRNKILRrA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039