UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OFVGltLsdB8dLcuzfV4gfkioaa1UjBM3weEwsSj506I=' 
WHERE 
  key_id = 'b28155c33bd67c874dc27b10cf71143c5684e53738b38bb188021b7cf917897c' 
  AND (
    token = 'OFVGltLsdB8dLcuzfV4gfkioaa1UjBM3weEwsSj506I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025