UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5U7ePN88SC33Y2gOpPdqPiyrfdaqlaN8UUPYAkYgjE=' 
WHERE 
  key_id = '8e5df0d5c28964261d27886cf96050a93df8ae90bb09513ce7b622733746d00e' 
  AND (
    token = 'A5U7ePN88SC33Y2gOpPdqPiyrfdaqlaN8UUPYAkYgjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023