UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Lv/KY+NA1Ns4M3f/1a1qOFMvcpiXY4RtMX8SfjqGH4=' 
WHERE 
  key_id = '8e7fb1589be3024a0ccb6441c3b0750df091b44cb02afa5996a731ef3662c8b3' 
  AND (
    token = '8Lv/KY+NA1Ns4M3f/1a1qOFMvcpiXY4RtMX8SfjqGH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041