UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pejcNFyHwvy0W/SIaS59GqjLh52ZP1uFE1WPEyCx5g8=' 
WHERE 
  key_id = '702149d0a9bdf2309608c70e2d1fe50e3ec93481785e72b2088483240f29c045' 
  AND (
    token = 'pejcNFyHwvy0W/SIaS59GqjLh52ZP1uFE1WPEyCx5g8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021