UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FDdDWdvgbLrvzYpSfnJAXpAPNakNX7C+pt0HhefPU3s=' 
WHERE 
  key_id = '73855a4cfde0de8c77d61e18af389e3970fcd02576b347195a354a7cb3a4111b' 
  AND (
    token = 'FDdDWdvgbLrvzYpSfnJAXpAPNakNX7C+pt0HhefPU3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062