UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lY52EXf5nl/kf28ZpjZpDoTVN+TVGNnUFy2YjnEX29M=' 
WHERE 
  key_id = '7a59a7d9b1dab8a2fbb5af5544b6bb4d695421ac7a3239d62c6dcfcd5b01678e' 
  AND (
    token = 'lY52EXf5nl/kf28ZpjZpDoTVN+TVGNnUFy2YjnEX29M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039