UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8cnLvhBTYUonEvBfQen+6R2Z85GWvG/3CBvi9KeLZ/k=' 
WHERE 
  key_id = '87c7b68c95552550bc8fa9af24b1fa6a2d3cd617ae826cc195d5f29d82182661' 
  AND (
    token = '8cnLvhBTYUonEvBfQen+6R2Z85GWvG/3CBvi9KeLZ/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043