UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nsXeo/DHxQKdRExqRtuvPHI1s5q97IW4uLiKylCgWUA=' 
WHERE 
  key_id = '9789bc2b3188210359104533403aa7e3fba2b20b56d37a1d23460f91c90df093' 
  AND (
    token = 'nsXeo/DHxQKdRExqRtuvPHI1s5q97IW4uLiKylCgWUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031