UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/pg8GBJf0bmhz/ijfbC9VlLkUw4Oeri5yOzlSaydt/s=' 
WHERE 
  key_id = '7cee7ff708b5416a39848385f58f4f7e31412516fb48966b2ff37a43a2838130' 
  AND (
    token = '/pg8GBJf0bmhz/ijfbC9VlLkUw4Oeri5yOzlSaydt/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076