UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l5zz4/rpWPzMoWZqwidXq0WzMtldE5rH40hyGgwuCFY=' 
WHERE 
  key_id = '8324797b468d9c7d52ca36a0e97f2bd488a87d9cdd66f9af39e3a7bd9c6b8953' 
  AND (
    token = 'l5zz4/rpWPzMoWZqwidXq0WzMtldE5rH40hyGgwuCFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043