UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZwycBiTBtGU3qiyD9ugTERiqYn4s1n8XjMbFmFsrvdA=' 
WHERE 
  key_id = '121e1ac24b02a23745f6ef2159a9a755e86a7f633b6ec3f13e09055228678e2e' 
  AND (
    token = 'ZwycBiTBtGU3qiyD9ugTERiqYn4s1n8XjMbFmFsrvdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044