UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RW2LtDYqMWPGJ+WO0Io6ZiNNd7KgxQKbiXe+HAGHdeo=' 
WHERE 
  key_id = '054c1ab7dd22683257dd50f5c943131bf31522e29e32119853d4306dccc8fb1a' 
  AND (
    token = 'RW2LtDYqMWPGJ+WO0Io6ZiNNd7KgxQKbiXe+HAGHdeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064