UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aAUeRA8PDltz1U3EIyzcpSYe1+MDXESiHHdYzDPgQwc=' 
WHERE 
  key_id = 'f1c384597b22bba210a9cdee6049a8fc296a6aed993bd2f80ed7ab7a109cb8ce' 
  AND (
    token = 'aAUeRA8PDltz1U3EIyzcpSYe1+MDXESiHHdYzDPgQwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025